home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 726-750 / 746 / skew / skew.readme < prev    next >
Text File  |  1995-03-18  |  8KB  |  179 lines

  1.  
  2. WHAT IS THIS?
  3.  
  4. I wrote this program because:
  5.  
  6.     1. I wanted to learn something about the new Amiga gadgetry (and
  7.        request'ry).
  8.  
  9.     2. Nobody else did.
  10.  
  11. "Skew" (stands for "SKEleton Writer") is a tool for generating C code for
  12. various Intuition based applications on the Amiga. You click the mouse and
  13. the code gets written. There are already a couple of such programs -- Jan van
  14. den Baard's "PowerSource" and "GadToolsBox" (this latter was, by the way,
  15. intensively used by myself while writing this stuff here), Matt Dillon's
  16. "TplEdit" etc. They generate code for screens, windows, gadgets, menues and
  17. so on; being even capable of creating (with some your help) a wholly runnable
  18. program. If so -- why would I need this stuff, you're asking?
  19.  
  20. Well -- Skew's domain is slightly different: it WON'T create a runnable
  21. program by itself, but, for a cost of twenty or fifty mouse clicks, it CAN
  22. save you typing some hundred lines of C code. More -- in most cases you would
  23. be typing with only one finger holding some interesting but not very handy
  24. book like the "Amiga ROM Kernel Reference Manual" with other hand...
  25.  
  26. All the (splendid!) programs I mentioned earlier WILL write you a complete
  27. code you can compile and run; the resulting programs WILL have beautiful
  28. gadgets, menues etc. but -- if you want to have a prrogram that DOES something
  29. non-trivial -- you will still write the code for the IDCMP handling yourself
  30. and merge it with the (machine-generated or not) code. Some typing is
  31. involved here if your application is more or less sophisticated.
  32.  
  33. Enters "Skew" and what it does? "Skew" generates namely the function (named
  34. by default) GetIDCMP() with the pertaining switch and cases for the various
  35. Class'es in IntuiMessage; as well as some other related stuff. If one
  36. consideres that there is 26 such classes now and they all have long, all-
  37. uppercase names it might seem strange that nobody got the idea of any
  38. automatization here...
  39.  
  40.  
  41. ------------------------------------------------------------------------
  42. HOW TO?
  43.  
  44. When (if?) you start the program you see a screen with a couple of gadgets
  45. and a logo. The purpose of the gadgets in the lowest row should be rather
  46. obvious. In the string gadget you place the name of the IDCMPWindow (which
  47. can be a requester) or you can leave the default name.
  48.     The other gadgets: the check-buttons with "Class", "Code", "Qualifier"
  49. etc.  written by them are the fields in IntuiMessage you are interesting in
  50. reading. "Class" is pre-set because:  firstly -- it is so often needed,
  51. secondly -- you would not get much of this program if you do not want them.
  52. However, even if you turn "Class" off, you will get this variable read by the
  53. resulting code, if any of the flag values on the next 'screen' (backdrop
  54. window actually) is set, and "Skew" sees that you will need it after all. So
  55. wise it is -- sheer IA!! And you always will be able, of course, to return
  56. whenever you wish to change the settings or merely see them.
  57.  
  58. Then you go to the second 'screen' with the groups of check-button gadgets in
  59. groups of two, in addition to the big (and obvious) ones at the bottom. One of
  60. such pair has i.e. "MOUSEBUTTONS" inscribed to its left, while the other has
  61. "F". Now -- if you set ANY of them ON, you will get a case for MOUSEBUTTONS
  62. in the generated switch, if you set this with "F" ON (no matter what is the
  63. state of the other one!) -- you will get a function call in this case. It is
  64. something like that:
  65.  
  66.     without "F":
  67.  
  68.             switch ( class ) {
  69.  
  70.                 ...                     <--- earlier cases
  71.  
  72.                 case MOUSEBUTTONS:
  73.                                         <--- place for your code
  74.                     break;
  75.  
  76.                 ...                     <--- more cases
  77.  
  78.     with "F":
  79.  
  80.             switch ( class ) {
  81.  
  82.                 ...                     <--- earlier cases
  83.  
  84.                 case MOUSEBUTTONS:
  85.                     MouseButtons();
  86.                     break;
  87.  
  88.                 ...                     <--- more cases
  89.  
  90.  
  91. Now, the MouseButtons() might be called something like
  92. HandleMouseButtons123(); and you may even get its prototype (ANSI-style), as
  93. well as a 'skeleton' -- see below.
  94.  
  95. Not so much, I agree, but always less typing (remember the one finger bit!).
  96. and there is still (slightly...) more!!!
  97.  
  98. When we turn to the third 'screen' we can set some general options like:
  99.  
  100.     1. The name for the GetIDCMP() function in case you do not like this
  101.        name, or, for example, need stuff like GetIDCMP1(), GetIDCMP2(), ...
  102.        GetIDCMP25(). A string gadget.
  103.  
  104.     2. Prefix and suffix for the generated 'child functions' so that, for
  105.        instance, MouseButtons() becomes my_new_MouseButtons_turbo(). Two
  106.        string gadgets for that.
  107.  
  108.     3. Whether you will want function prototypes. A cycle gadget.
  109.  
  110.     4. If you will want function 'skeletons' in the form more or less like:
  111.  
  112. VOID MouseButtons()
  113. {
  114.  
  115. }
  116.  
  117. or
  118.  
  119. MouseButtons()
  120. {
  121.  
  122. }
  123.  
  124. , but it is possible to got EVEN MORE!!!. It is a cycle gadget.
  125.  
  126.     5. Whether you will use the new gadtools.library -- if you will you
  127.        should have this set!
  128.  
  129.     6. A cycle gadget with which you decide if you want to passively
  130.        wait for the messages, or maybe you will need to spin and do something
  131.        like i.e. printing a banner (or something much more ambitious) in the
  132.        meantime. The place the code for that should be placed will be marked
  133.        if you set the "comments" and/or "fill-ins" flag on.
  134.  
  135.     7. A cycle gadget with which you decide if the variables should be local
  136.        or global. It might be much easier to use globals, but you know --
  137.        globals are 'impure' they say...
  138.  
  139.     8. Do you want verbose comments, some comments or none at all? The
  140.        comments are really not very enlighting, and the difference between
  141.        "verbose" and "sparse" in not great. I simply got tired of inventing
  142.         them, you know...
  143.  
  144.     9. Fill-ins -- also a cycle gadget. You decide whether you want the
  145.        places where you will have to put something marked with '@@',
  146.        '/* @@ */', '@@@@@@@@@@', or not marked at all. The idea is here that
  147.        should be easy to find the '@@' from an editor, but you might want
  148.        them commented-out if you are trying to compile an un-finished code.
  149.        The '@@@@@@@@@@' shoud be easy to spot with bare eye, if you for
  150.        instance want to see how much you will need to type yourself. Most of
  151.        the places to fill in will be marked, but not necessarily all -- if
  152.        you do something more with a function than only call it there WILL be
  153.        slightly more.
  154.  
  155.  
  156. ------------------------------------------------------------------------
  157. SOME FINAL REMARKS:
  158.  
  159. "Skew" is not a hyper smart program: it will let you, for instance, type
  160. stupid names in the string gadgets and do many other things like that; you
  161. will be able to correct all this later, in your editor. The code generated is
  162. in EXTREMELY LOOSE format that you might hate, I believe that it is easier to
  163. see things this way. 2.0x. On the other hand, however, its 'pure'. It should
  164. open on interlaced screen if you have NTSC. It is in Public Domain. "Skew" was
  165. compiled with DICE 2.6 (registered version); much if not most of the code for
  166. the screen, window & gadgets was generated by GadToolsBox; while the editor I 
  167. am always using (and love dearly) is UEdit now 3.0c (registered).
  168.  
  169.  
  170.                                     Piotr Obminski
  171.  
  172.                                     Flogstavägen 43C:323
  173.  
  174.                                     752 63 UPPSALA
  175.  
  176.                                         SWEDEN
  177.  
  178.                                     tel. 018-46 38 32
  179.